home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / compuserve-file-archive / 04 geoProgramming / FORMAT.BIN < prev    next >
Encoding:
Text File  |  2019-04-13  |  4.2 KB  |  130 lines

  1. GEOPAINT FILE FORMAT
  2.  
  3.      Cards and color on the c64 (background).
  4. The graphics mode used by GEOS on the c64 supports 320 by
  5. 200 resolution, organized as a 40 by 25 matrix of 8 by 8
  6. pixel cards.  These cards are stored in the frame buffer
  7. from left to right, top to bottom.  The diagram below
  8. better illustrates this format.
  9.  
  10. ON SCREEN: 
  11. card0   card1   card2  ...   card39 
  12. card40  card41  card42 ...   card79 
  13.  .
  14.  .
  15. card960 card961 card962 ...  card999
  16.  
  17. EACH CARD:  byte0
  18.             byte1
  19.             ...
  20.             byte6 
  21.             byte7 
  22.      Each byte contains 8 bits, 1 per pixel on the screen.
  23. These eight bytes make up an 8 by 8 pixel image.
  24.  
  25. IN FRAME BUFFER: 
  26.                CARD0    CARD1    CARD2
  27. CARD ROW 0 ->       byte0   byte8   byte 16 
  28.           ...      ...      ... 
  29.           byte7    byte15  byte23 
  30.  
  31.                CARD40   CARD41   CARD42 
  32. CARD ROW 1 ->     byte320  byte328 byte336 
  33.            ...      ...      ...
  34.           byte327  byte335 byte443
  35.  
  36.      This graphics mode supports 16 colors, but the color
  37. resolution is limited to card boundaries.  That is, two
  38. colors can be specified for each card on the screen -- a
  39. background color (bits set to 0 in the card) and a
  40. foreground color (bits set to 1 in the card).  This color
  41. information is stored separately from the frame buffer,
  42. one byte per card.  The high 4 bits in the byte specify
  43. one of 16 colors to be used for the foreground, and the
  44. low four bits specify the background color.
  45. GEOPAINT FILE FORMAT 
  46. -------- ---- ------
  47.      A geoPaint data file is a VLIR file with 45 records.
  48. (For info on what a VLIR file is, see the GEOS Programmer's
  49. Reference Manual).  Each record holds the image and color
  50. data for an area of the page 16 lines high by 640 pixels
  51. wide.  A geoPaint document is 720 lines high by 640 pixels
  52. wide, so each record represents two card rows of the
  53. entire document.  The image data is stored in the same
  54. card format used by the 320 by 200 graphics mode on the
  55. c64, discussed above.
  56.      When a geoPaint file is created, all 45 records are
  57. marked as used in the index table of the VLIR file.  The
  58. track and sector pointers are set to $00,$FF to indicate
  59. an empty record; instead of $00,$00 which indicates an
  60. unused record.
  61.      The 45 records are assigned to alternate card rows,
  62. from top to bottom on the document.  That is, record 0
  63. contains the image and color data for card rows 0 and 1;
  64. record 1 for card rows 2 and 3, etc.
  65.      The image and color info is compacted before being
  66. written to the record.  The pre-compacted layout of the
  67. data is:
  68.  
  69. #bytes  start/end ($)  description 
  70. ------  -------------  ----------- 
  71.  640     000 - 27F     image data for 
  72.                        1st card row 
  73.  
  74.  640     280 - 4FF     image data for 
  75.                        2nd card row 
  76.  
  77.    8     500 - 507     all zeroes. 
  78.  
  79.   80     508 - 557     color info for 
  80.                        first card row 
  81.  
  82.   80     558 - 5A7     color info for 
  83.                        2nd card row
  84.  
  85.      The eight bytes of zero were included in geoPaint 1.0
  86. files through an oversight, and retained after that for
  87. compatability.
  88. COMPACTION FORMAT 
  89. ---------- ------
  90.      The compaction routine operates on the entire 1448
  91. bytes at once, resulting in a string of bytes in the
  92. following format.
  93.  
  94.   ---------------------
  95.   ! command/count ! data !
  96.   !     byte      ! byte !
  97.   --------------------- ......
  98.  
  99.      Where there is one command/count byte, and from 1 to
  100. 63 data bytes.  This pattern is repeated until all 1448
  101. bytes are represented.  The command/count byte is
  102. interpreted as follows:
  103.  
  104. hex value   interpretation 
  105. ---------   -------------- 
  106. $00         End of record 
  107.  
  108. $01 - $3F   Use command byte as COUNT.
  109.             The following COUNT data 
  110.             bytes are uncompacted. 
  111.  
  112. $40         Invalid command byte. 
  113.  
  114. $41 - $7F   Subtract $40 from the
  115.             command byte, use the
  116.             result as COUNT. The next
  117.             8 data bytes comprise a
  118.             card to repeat COUNT times.
  119.             These 8 data bytes expand 
  120.             to 8*COUNT image bytes. 
  121.  
  122. $80         Invalid command byte. 
  123.  
  124. $81 - $FF   Subtract $80 from the
  125.             command byte, use the
  126.             result as COUNT. Repeat the
  127.             single data byte that
  128.             follows COUNT times. This
  129.             single byte expands to
  130.             COUNT image bytes.